package Java9_8;

import java.util.Scanner;
import java.util.Set;

public class CompantTest {
    public static void main(String[] args) {
        SetCompany a = new SetCompany("网易", "合肥", "110120", "音乐");
        Scanner in = new Scanner(System.in);
        while (true) {
            System.out.print("1：招聘员工  2：查看员工信息  3：辞退员工  4：统计公司人数  5：查找薪水最高的员工  9：退出\n");
            System.out.println("请输入您的选择：");
            int ch = in.nextInt();
            if (ch == 1) {
                Person s = new Person();
                System.out.println("请输入招聘员工的工号，姓名，年龄，性别，职位和薪水：");
                s.setGonghao(in.next());
                s.setName(in.next());
                s.setAge(in.nextInt());
                s.setSex(in.next());
                s.setZhiwu(in.next());
                s.setMoney(in.nextInt());
                boolean gonghao = a.zhaopin(s);
                System.out.println(gonghao ? "招聘成功" : "招聘失败，工号重复");
            } else if (ch == 2) {
                a.show();
            } else if (ch == 3) {
                System.out.println("请输入辞退员工的工号：");
                String gh = in.next();
                boolean citui1 = a.citui(gh);
                System.out.println(citui1 ? "辞退成功" : "没有这个人");
            } else if (ch == 4) {
                System.out.println("公司共有" + a.shuliang() + "人");
            } else if (ch == 5) {
                Person max = a.maxmoney();
                if (max == null) {
                    System.out.println("公司没人");
                } else {
                    System.out.println("工号为" + max.getName() + "的薪水最高为：" + max.getMoney());
                }
            } else if (ch == 9) {
                return;
            }
        }
    }
}
